<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>公司信息管理</title>
    <!-- Bootstrap -->
    <link href="../bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="container">
    <nav th:replace="~{system/sys/sys_topbar::top}"></nav>
    <div class="page-header">
        <div class="row">
            <h1 class="col-md-3">公司信息管理 </h1>
            <form class="form-inline col-md-3" style="margin: 20px">
                <div class="form-group">
                    <input type="text" class="form-control" name="comName" id="comName" placeholder="请输入要查询的公司名称">
                </div>
                <button type="submit" class="btn btn-default" id="searchBtn" >查询</button>
            </form>
        </div>
        <a th:href="@{/comAddBefore}"><button type="button" class="btn btn-info">添加公司信息</button></a>
    </div>
    <table class="table table-hover">
        <thead>
        <tr>
            <th>公司名称</th>
            <th>公司类型</th>
            <th>公司电话</th>
            <th>公司地址</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="company:${results}">
            <th th:text="${company.companyName}">广州鑫顺诚物流有限公司</th>
            <th th:text="${company.property}">有限责任公司</th>
            <th th:text="${company.phoneNumber}">020-62198110</th>
            <th th:text="${company.addressCity}">广州市</th>
            <th style="width: 140px"><a th:href="@{'/com_detail?companyId='+${company.companyId}+'&page=1'}"><button type="button" class="btn btn-link" style="padding: unset">详细信息>>></button></a></th>
            <th><a th:href="@{'/comDelete?comId='+${company.companyId}+'&page=1'}"><button type="button" class="btn btn-danger" style="padding-bottom: unset; padding-top: unset">删除</button></a></th>
        </tr>
        </tbody>
    </table>
</div>

<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
<script src="../jquery-3.3.1.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="../bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>

<script>
    $("#searchBtn").click(function () {
        var searchCom = $("#comName").val();
        window.location.href("/findComByComName?comName="+searchCom);
    })
</script>

</body>
</html>